package com.econorma.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import com.econorma.dao.DatabaseConnection;
 



public class DatabaseConnection {
	
	private static DatabaseConnection manager;
	private static final Logger logger = Logger.getLogger(DatabaseConnection.class);
	private static final String TAG = "DAO";

	public static synchronized DatabaseConnection getInstance() {
		if (manager == null) {
			manager = new DatabaseConnection();
		}
		return manager;
	}
	
	
	public boolean init() {
	 
		try {
			Class.forName("org.sqlite.JDBC");
				
		} catch (ClassNotFoundException e) {
			logger.error(TAG,e);
			return false;
		}
		
		return true;
		
	}
	
	
	public Connection getConnection() {
		Connection conn = null;
		try {
			conn = DriverManager.getConnection("jdbc:sqlite:database.db");
		} catch (SQLException e) {
		}
		return conn;
	}
	
}
